import 'package:common_utils/common_utils.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_learn_vi/src/bean/bean_user.dart';
import 'package:flutter_learn_vi/src/net/dio_utils.dart';
import 'package:flutter_learn_vi/src/page/common/common_loading_dialog.dart';
import 'package:flutter_learn_vi/src/page/common/common_pdf_page.dart';
import 'package:flutter_learn_vi/src/utils/navigator_utils.dart';
import 'package:flutter_learn_vi/src/utils/toast_utils.dart';

/// 创建人： Created by zhaolong
/// 创建时间：Created by  on 2021/2/15.
///
/// 可关注公众号：我的大前端生涯   获取最新技术分享
/// 可关注网易云课堂：https://study.163.com/instructor/1021406098.htm
/// 可关注博客：https://blog.csdn.net/zl18603543572
///
/// 代码清单
///代码清单
class MineLineResumPage extends StatefulWidget {
  final UserBean userBean;

  const MineLineResumPage({Key key, @required this.userBean}) : super(key: key);

  @override
  _MineLineResumPageState createState() => _MineLineResumPageState();
}

class _MineLineResumPageState extends State<MineLineResumPage> {
  @override
  void initState() {
    super.initState();
    _getUserWorkList();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("在线简历"),
      ),
      backgroundColor: Colors.white,

      ///填充布局
      body: Center(
        child: LoadingWidget(),
      ),
    );
  }

  Future<bool> _getUserWorkList() async {
    ResponseInfo partResponseInfo = await DioUtils.instance.getRequest(
      url: HttpHelper.userWorkLine + "/${widget.userBean.userId}",
    );
    if (partResponseInfo.success) {
      String url = partResponseInfo.data;
      NavigatorUtils.pushPage(
        context,
        PdfWidgetPage(
          title: "在线简历",
          url: HttpHelper.userWorkLineResum + url,
        ),
        isReplace: true,
      );
    } else {
      LogUtil.e("加载失败");
      ToastUtils.showToast("加载失败${partResponseInfo.message}");
      NavigatorUtils.pop(context);
    }

    return Future.value(true);
  }
/**
 *
 */
}
